<!doctype html>
<html lang="cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
    <meta name="generator" content="Hugo 0.80.0">
    <title>新增博客</title>

    <!-- Bootstrap core CSS -->
    <link th:href="@{/css/bootstrap.css}" rel="stylesheet">

    <link rel="stylesheet" th:href="@{/lib/editormd/css/editormd.css}"/>

    <style>
        .bd-placeholder-img {
            font-size: 1.125rem;
            text-anchor: middle;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        @media (min-width: 768px) {
            .bd-placeholder-img-lg {
                font-size: 3.5rem;
            }
        }
    </style>

    <link th:href="@{/css/dashboard.css}" rel="stylesheet">
</head>
<body>

<!--头部导航栏-->
<div th:replace="commons/common_admin::topNavigationBar()"></div>

<div class="container-fluid">
    <div class="row">

        <!--侧边栏-->
        <div th:replace="commons/common_admin::sidebar(addBlog)"></div>

        <!--内容-->
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4">

            <div style="margin-bottom: 20px"></div>


            <form th:action="@{/admin/publish}" method="post">
                <div class="form-row">
                    <div class="form-group col-md-6">
                        <label for="exampleFormControlInput1">博客标题</label>
                        <input type="text" name="blogTitle" class="form-control" id="exampleFormControlInput1"
                               placeholder="xxx" required>
                    </div>
                    <!--可以设置为下拉框-->
                    <!--<div class="form-group col-md-6">-->
                    <!--    <label for="exampleFormControlInput2">标签</label>-->
                    <!--    <input type="text" name="blogTags" class="form-control" id="exampleFormControlInput2"-->
                    <!--           placeholder="xxx">-->
                    <!--</div>-->
                    <div class="form-group col-md-6">
                        <label for="exampleFormControlInput3">自定义路径</label>
                        <input type="text" name="blogCustomUrl" class="form-control" id="exampleFormControlInput3"
                               placeholder="自定义路径，否则为随机id">
                    </div>
                    <!--此处应该为下拉框-->
                    <div class="form-group col-md-6">
                        <label for="exampleFormControlSelect1">Example select</label>
                        <select class="form-control" id="exampleFormControlSelect1" name="blogCategoryId">
                            <option th:each="category:${categories}" th:text="${category.categoryName}" th:value="${category.categoryId}"></option>
                        </select>
                    </div>
                    <div class="form-group col-md-6">
                        <label for="exampleFormControlSelect2">发布状态</label>
                        <select class="form-control" id="exampleFormControlSelect2" name="blogStatus">
                            <option th:value="0" th:text="草稿"></option>
                            <option th:value="1" th:text="发布"></option>
                        </select>
                    </div>
                    <div class="form-group col-md-6">
                        <label for="exampleFormControlSelect3">能否评论</label>
                        <select class="form-control" id="exampleFormControlSelect3" name="enableComment">
                            <option th:value="1" th:text="允许评论"></option>
                            <option th:value="0" th:text="不允许评论"></option>
                        </select>
                    </div>
                    <!--后期改成 Markdown 编辑器-->
                    <div class="form-group col-md-12">
                        <label for="exampleFormControlTextarea1">博客内容</label>
                        <div id="content-editormd">
                            <textarea id="exampleFormControlTextarea1" name="blogContent"
                                      style="display:none;"></textarea>
                        </div>
                    </div>
                </div>
                <div class="text-center">
                    <button type="submit" class="btn btn-primary mb-2">发布</button>
                </div>
            </form>

        </main>
    </div>
</div>


</body>
<div th:replace="commons/common_admin::adminJs"></div>
<script th:src="@{/lib/editormd/editormd.min.js}"></script>
<script type="text/javascript">
    var contentEditormd;

    $(function () {
        contentEditormd = editormd("content-editormd", {
            width: "100%",
            height: 640,
            syncScrolling: "single",
            path: "/lib/editormd/lib/",
            // 自定义工具栏
            toolbarIcons: function () {
                // 去除 fullscreen 会错位
                // 去除 html-entities 加载慢
                return [
                    "undo", "redo", "|",
                    "bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|",
                    "h1", "h2", "h3", "h4", "h5", "h6", "|",
                    "list-ul", "list-ol", "hr", "|",
                    "link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime", "emoji", "pagebreak", "|",
                    "goto-line", "watch", "preview", "clear", "search", "|",
                    "info"
                ]
            }
        });
    });
</script>
<div th:replace="commons/common_admin::searchBlogJs"></div>
</html>
